package zwo.controller;

import zwo.dao.OrdersMapper;
import zwo.model.Orders;
import zwo.model.dto.OrdersDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/admin/orders")
public class OrdersController {
    @Resource
    private OrdersMapper ordersMapper;

    @ResponseBody
    @RequestMapping("/ordersAll.do")
    public Map ordersAll(OrdersDTO ordersDTO) {
        //ordersDTO.setPage((ordersDTO.getPage()-1)*ordersDTO.getLimit());
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("code", "0");
        map.put("msg", "");
        map.put("count",ordersMapper.ordersAllCount(ordersDTO));
        map.put("data",ordersMapper.ordersAll(ordersDTO));
        return map;
    }
    @ResponseBody
    @RequestMapping("/ordersAddwaybill.do")
    public Integer ordersAddwaybill(Orders orders){
        return ordersMapper.ordersAddwaybill(orders);
    }
}
